﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Bowerbird.Api
{
    public static class Urn
    {
        public static string Create(UrnResource urnResource, string identifier)
        {
            return String.Format("urn:bowerbird:{0}:{1}", urnResource.LowerString(), identifier ?? "null");
        }

        public static string LowerString(this UrnResource resource)
        {
            return resource.ToString().ToLower();
        }


        public static string GetIdentifier(string value)
        {
            string[] parts = value.Split(':');

            return parts[3];
        }
    }

    public enum UrnResource
    {
        User
    }

}